//
//  SinaComposeButton.swift
//  mySina
//
//  Created by 刘莹 on 2016/11/21.
//  Copyright © 2016年 liuying. All rights reserved.
//

import UIKit
import pop

let composeBtnImageWidth: CGFloat = 80
let composeBtnHeight: CGFloat = 110


class SinaComposeButton: UIButton {
    
    //MARK: -
    //MARK: - 懒加载
    
    
    
    //MARK: -
    //MARK: - 重写构造函数
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.titleLabel?.textAlignment = .center
        self.titleLabel?.font = UIFont.systemFont(ofSize: 14)
        self.setTitleColor(UIColor.darkGray, for: .normal)
    }
    //MARK: -
    //MARK: - 只能手写代码创建,storyboard报错
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //MARK: -
    //MARK: - 返回titleLabel的frame
    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: composeBtnImageWidth, width: composeBtnImageWidth, height:composeBtnHeight - composeBtnImageWidth)
    }
    //MARK: -
    //MARK: - 返回imageView的frame
    override func imageRect(forContentRect contentRect: CGRect) -> CGRect {
        
        return CGRect(x: 0, y: 0, width: composeBtnImageWidth, height: composeBtnImageWidth)
    }
   
}
